package game.util.template;

import game.ioc.ProductInstance;
import game.ioc.control.ControlHiv;
import game.page.AbstractServlet;
import game.util.conf.ConfStatic;

/**
 * A representation layer's tag generator.
 * 
 * @author Linzy
 * Create Date: 2010 1 5 14:47:52
 */
public class TagGen {
	
	private static ControlHiv ctlHiv = (ControlHiv)ProductInstance.getInstance(ControlHiv.class.toString());
	
	private String wapVer = AbstractServlet.defaultwapver;
	
	public TagGen(String uId){
//		try {
			wapVer = ctlHiv.getWapVerFromCach(uId, AbstractServlet.defaultwapver); 
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
	}
	
	public String lineSep(){
		return "<br/>";
	}
	
	/**
	 * Get the image's link, such as {@code <img src='' alt='' />}.
	 * 
	 * @param imgId String; The image's id of entity ImageInfo.
	 * @return
	 */
	public String getImgLink(String url,String name){
		StringBuilder sb = new StringBuilder();
		sb.append("<img src='");
		sb.append(ConfStatic.fileServerPath + url);
		sb.append("' alt='"+name+"' />");
		return sb.toString();
	}
	
	
} // end of class
